<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<script type="text/javascript" src="../../js/swiper.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<title>游戏详情</title>
</head>
<body>
<header>
	<a href="javascript:;" onclick="window.history.back()"><img src="../../images/fanhui.png"/></a>
	应用详情
</header>
<div class="container-fluid" style="margin-top:2.6rem;">
	<div class="row detal-top">
		<div class="col-xs-12" id="detalName">
			<img src="../../images/loading.gif"/>
			<p>加载中……</p>
		</div>
	</div>
	<div class="row">
		<div class="swiper-circle">
			<div class="swiper-wrapper" id="detalPicture">



			</div>
		</div>
	</div>
	<div class="row" id="detalInfo">
		 <p>详情火速赶来中……</p>
	</div>
</div>
<footer class="install-footer">
	<a href="javascript:;" data-src="{$data->dowmloadurl}" onclick="down(this)">安装</a>
</footer>
<script type="text/javascript" src="../../js/jquery-1.9.1.js"></script>
<script>
var swiper = new Swiper('.swiper-circle', {
	slidesPerView:2.5,
	paginationClickable: true,
	freeMode: true
});
var url = window.location.href;
var gameId = url.substring(url.lastIndexOf('=')+1);
loading(gameId);

//加载游戏详情
function loading(gameId){
  	var url = "http://aaa.57810.mom/index.php/Game/info";
	var data = {gameId:gameId};
	$.ajax({
		type : "get",
		url : url,
		dataType : "jsonp",
		data:data,
		jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
		jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
		success : function(json){
			 console.log(json);
             var detalName = document.getElementById('detalName');
			 var detalPicture = document.getElementById('detalPicture');
			 var detalinfo = document.getElementById('detalInfo');
			 var nameHtml = "<img src='http://115.29.42.246:8080/kuyun/"+json['data']['gameImgUri']+"'/><p>"+json['data']['gameTitle']+"</p>";
			 detalName.innerHTML = nameHtml;
			 picListHtml = "";
			 for(var i=0;i<json['piclist'].length;i++){
				 picListHtml += ' <div class="swiper-slide"><img src="http://115.29.42.246:8080/kuyun/'+json['rootpic']+"/"+json['piclist'][i]+'"/></div>'
			 }
			 detalHtml = '<div class="col-xs-12 detal-size">版本:'+json['data']['gameVersionName']+'<span>应用大小:'+json['data']['gameSize']+'</span><span>时间:'+json['data']['gameVersionTime']+'</span></div><div class="col-xs-12 detal-size">应用介绍：<img src="../../images/more.png"/></div><div class="col-xs-12 detal-info">'+json['data']['gameDescription']+'</div>'
			detalPicture.innerHTML = picListHtml;
			detalinfo.innerHTML = detalHtml;
		},
		error:function(){
			alert('fail');
		}
	});
}

function down(obj){
	 var downloadUrl = obj.getAttribute("data-src");
	 android.dowonload(downloadUrl);
}

</script>
</body>
</html>
